
package com.ebupt.migu.music.global.controller;

import javax.annotation.Resource;
import javax.validation.Valid;

import org.springframework.web.bind.annotation.*;

import com.ebupt.migu.globalpopup.entity.H5Info;
import com.ebupt.migu.music.common.entity.ResultObject;
import com.ebupt.migu.music.global.dto.H5InfoDTO;
import com.ebupt.migu.music.global.service.IH5InfoService;
import com.ebupt.migu.music.global.wrapper.Query;

/**
 * h5活动连接表 控制器
 *
 * @author wangzhu
 * @since 2021-11-26
 */
@RestController
@RequestMapping("/global/h5info")
public class H5InfoController {

    @Resource
    private IH5InfoService h5InfoService;

    /**
     * 详情
     */
    @GetMapping("/detail")
    public ResultObject detail(String id) {

        return h5InfoService.detail(id);
    }

    /**
     * 详情
     */
    @GetMapping("/audit/detail")
    public ResultObject auditDetail(String id) {
        return h5InfoService.auditDetail(id);
    }

    /**
     * 自定义分页
     */
    @GetMapping("/page")
    public ResultObject page(Query query) {
        return h5InfoService.page(query);
    }

    /**
     * 审核分页
     */
    @GetMapping("/audit/page")
    public ResultObject auditPage(Query query) {
        return h5InfoService.auditPage(query);
    }

    /**
     * 新增
     */
    @PostMapping("/save")
    public ResultObject save(@Valid @RequestBody H5Info h5Info) {
        return h5InfoService.saveH5Info(h5Info);
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public ResultObject update(@Valid @RequestBody H5Info h5Info) {
        return h5InfoService.update(h5Info);
    }

    /**
     * 删除
     */
    @PostMapping("/remove")
    public ResultObject remove(@RequestParam String ids) {
        return h5InfoService.remove(ids);
    }

    /**
     * 审核
     */
    @PostMapping("/audit")
    public ResultObject audit(@Valid @RequestBody H5InfoDTO h5InfoDTO) {
        return h5InfoService.audit(h5InfoDTO);
    }

    /**
     * 审核
     */
    @PostMapping("/untie")
    public void untie(@RequestParam String id) {
        h5InfoService.untie(id);
    }

}
